package com.smile.f213;
import java.awt.BorderLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class ContainerDemo {
	public static void main(String[] args) {
		JFrame frame = new JFrame("Swing容器结构示例");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		JLabel label = new JLabel("位于JFrame上的标签");
		
		//frame.getContentPane().add(label, BorderLayout.NORTH);
		frame.add(label, BorderLayout.NORTH);
		JPanel panel = new JPanel();
		JButton button = new JButton("位于JPanel上的按钮");
		panel.add(button);
		//frame.getContentPane().add(panel,BorderLayout.CENTER);
		frame.add(panel,BorderLayout.CENTER);
		frame.setBounds(200, 200, 200, 120);
		frame.setVisible(true);
	}
}